package com.config;

import freemarker.template.Configuration;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;


/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/5/1 12:46
 * @since JDK 1.8
 */
@Component
public class CommonInitConfig {

    @Bean("commonpro")
    public Map<String, String> getProperties(){
        Map<String, String> stringStringMap=new HashMap<>();
        PropertiesCommonUtils.loadProperties("freemarker",stringStringMap);
        return stringStringMap;
    }

    @Bean("common-freemarker")
    @Primary
    public  Configuration freeMarkerConfig(){
        Configuration config=new Configuration(Configuration.VERSION_2_3_0);
        return config;
    }

    @Bean("sql")
    public Map<String, String> getSqlProperties(){
        Map<String, String> stringStringMap=new HashMap<>();
        PropertiesCommonUtils.loadProperties("sql",stringStringMap);
        return stringStringMap;
    }
}
